/**
 * @file init.c
 * @brief C Runtime Initializer
 *
 * @author yemt@witsi.cn
 * @date 2011-08-09
 * @version T1.init.01
 */
extern unsigned long _sidata;   /* start address for the initialization values of the .data section */
extern unsigned long _sdata;    /* start address for the .data section */
extern unsigned long _edata;    /* end address for the .data section */
extern unsigned long _sbss;     /* start address for the .bss section */
extern unsigned long _ebss;     /* end address for the .bss section */

void data_section_init(void)
{
        unsigned long *pulSrc, *pulDest;

        pulSrc = &_sidata;
        pulDest = &_sdata;
        if (pulSrc != pulDest) {
                for(; pulDest < &_edata; ) {
                        *(pulDest++) = *(pulSrc++);
                }
        }

        for(pulDest = &_sbss; pulDest < &_ebss; ) {
                *(pulDest++) = 0;
        }

        return;
}
